/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 *
 * @author Andres
 */
@Entity
@Table(name = "HOTEL", catalog = "", schema = "PROYECTO", uniqueConstraints = {
    @UniqueConstraint(columnNames = {"CONVENIOS_CODIGOCONVENIO"}),
    @UniqueConstraint(columnNames = {"DIRECCION_CODIGO"})})
@NamedQueries({
    @NamedQuery(name = "Hotel.findAll", query = "SELECT h FROM Hotel h"),
    @NamedQuery(name = "Hotel.findByRecursosIdrecurso", query = "SELECT h FROM Hotel h WHERE h.recursosIdrecurso = :recursosIdrecurso")})
public class Hotel implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "RECURSOS_IDRECURSO", nullable = false)
    private Integer recursosIdrecurso;
    @JoinColumn(name = "RECURSOS_IDRECURSO", referencedColumnName = "IDRECURSO", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false, fetch = FetchType.EAGER)
    private Recursos recursos;
    @JoinColumn(name = "DIRECCION_CODIGO", referencedColumnName = "CODIGO", nullable = false)
    @OneToOne(optional = false, fetch = FetchType.EAGER)
    private Direccion direccion;
    @JoinColumn(name = "CONVENIOS_CODIGOCONVENIO", referencedColumnName = "CODIGOCONVENIO")
    @OneToOne(fetch = FetchType.EAGER)
    private Convenios convenios;

    public Hotel() {
    }

    public Hotel(Integer recursosIdrecurso) {
        this.recursosIdrecurso = recursosIdrecurso;
    }

    public Integer getRecursosIdrecurso() {
        return recursosIdrecurso;
    }

    public void setRecursosIdrecurso(Integer recursosIdrecurso) {
        this.recursosIdrecurso = recursosIdrecurso;
    }

    public Recursos getRecursos() {
        return recursos;
    }

    public void setRecursos(Recursos recursos) {
        this.recursos = recursos;
    }

    public Direccion getDireccion() {
        return direccion;
    }

    public void setDireccion(Direccion direccion) {
        this.direccion = direccion;
    }

    public Convenios getConvenios() {
        return convenios;
    }

    public void setConvenios(Convenios convenios) {
        this.convenios = convenios;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (recursosIdrecurso != null ? recursosIdrecurso.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Hotel)) {
            return false;
        }
        Hotel other = (Hotel) object;
        if ((this.recursosIdrecurso == null && other.recursosIdrecurso != null) || (this.recursosIdrecurso != null && !this.recursosIdrecurso.equals(other.recursosIdrecurso))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Hotel[recursosIdrecurso=" + recursosIdrecurso + "]";
    }

}
